package com.zjc.yohoshop.mvp.view.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zjc.yohoshop.R;
import com.zjc.yohoshop.bean.CouponListEntity;

import java.text.SimpleDateFormat;
import java.util.Date;

public class CouponListWSYAdapter extends BaseQuickAdapter<CouponListEntity.ValuesBean, BaseViewHolder> {
    public CouponListWSYAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, CouponListEntity.ValuesBean item) {
        helper.setText(R.id.tv_item_coupon_list_vp_yoho_vp_wsy_item_coupon_condition, item.coupon_condition);//金额
        helper.setText(R.id.tv_item_coupon_list_vp_yoho_vp_wsy_item_coupon_title, item.coupon_title);//标题
        long longTime = Long.parseLong(item.coupon_data);
        Date date = new Date(longTime );//用Date构造方法，将long转Date
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dateString = formatter.format(date);
        helper.setText(R.id.tv_item_coupon_list_vp_yoho_vp_wsy_item_coupon_data, dateString);//日期
        helper.setText(R.id.tv_item_coupon_list_vp_yoho_vp_wsy_item_coupon_explain, item.coupon_explain);//使用说明
        helper.addOnClickListener(R.id.iv_item_coupon_list_vp_yoho_vp_wsy_item_ljsy);
    }
}
